/**
 * 
 */
package com.jf.cloud.service.sysmanager.common.taglib.html;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import java.io.IOException;

/**
 * 前台 body 标签
 * @author ouyang 创建时间：2012-03-07 08:42:54
 */
public class ForeBodyTag extends AbstractHtmlFormElementTag {
	
	private static final long serialVersionUID = 1L;
	protected String onload; // body 标签的加载方法
	protected String name;
	protected String style;

	/**
	 * 开始
	 */
	public int doStartTag() throws JspException {
		try {
			JspWriter writer = pageContext.getOut();
			StringBuffer sfBuffer = new StringBuffer();
			sfBuffer.append("<body ");
			if (id != null) {
				sfBuffer.append(" id=\"" + id + "\"");
			}
			if (name != null) {
				sfBuffer.append(" name=\"" + name + "\"");
			}
			if (style != null) {
				sfBuffer.append(" style=\"" + style + "\"");
			}
			if (onload != null) {
				sfBuffer.append(" onload=\"" + onload + "\"");
			}
			sfBuffer.append(" >");
			writer.println(sfBuffer.toString());
		} catch (IOException ex) {
			throw new JspException("展现标签HTML输出异常！", ex);
		}
		return SKIP_BODY;
	}

	/**
	 * 结束
	 */
	public int doEndTag() throws JspException {
		try {
			pageContext.getOut().write("</body>");
		} catch (IOException e) {
			e.printStackTrace();
		}
		return EVAL_BODY_INCLUDE;
	}

	public String getOnload() {
		return onload;
	}

	public void setOnload(String onload) {
		this.onload = onload;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}
}
